<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">

<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap-theme.min.css">

<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript">
function printDiv(divName) {
    var printContents = document.getElementById(divName).innerHTML;
    var originalContents = document.body.innerHTML;
    document.body.innerHTML = printContents;
    window.print();
    document.body.innerHTML = originalContents;
}
</script>
<div id="printableArea">
<?php foreach($inspection_guide as $ig):?>
	<table border=1 class="table table-bordered">
		<tr>
			<td colspan="4">INPECTION GUIDE REF NO.<?php echo $ig['ref_no'];?></td>
		</tr>
		<tr>
			<td colspan="4">SUBJECT/TYPE OF WORK :  <?php echo $ig['subject'];?></td>
		</tr>
		<tr>
			<td colspan="4">LANJUTAN DARI SUBJECT</td>
		</tr>
		<tr>
			<td colspan="2">DRAWING TITLE :  <?php echo $ig['drawing_title'];?></td>
			<td colspan="2">DRAWING NO. :  <?php echo $ig['drawing_no'];?></td>
		</tr>
		<tr>
			<td colspan="4">LOCATION<p>(AREA, NO.PIER, STA) : <?php echo $ig['location'];?></p></td>
		</tr>
		<tr height=100>
			<td colspan="2">WRITTEN BY : <br/><br/><br/><br/><br/><hr>--/--/-- ENGINEER</td>
			<td colspan="2">COUNTER SIGN BY : <br/><br/><br/><br/><br/><hr>--/--/-- CHIEF ENGINEER</td>
		</tr>
		<tr>
			<td width="10%">NO</td>
			<td colspan="2">DESCRIPTION/REMARK/SKETCH</td>
			<td width="10%">STATUS</td>
		</tr><?php $i=1;?>
		<?php foreach($list_question as $question):?>
		
		<?php if($question['id_ig'] == $ig['id_ig'])
		{
		?>
		<tr>
			<td><?php echo $i?></td>
			<td colspan="2">
			<p align="justify">
				<?=$question['desc']?>
				<?php foreach($childs as $child)
				{
					if($question['id_question'] == $child['parent'])
					{
						echo 	"<ul>
									<li>$child[desc]</li>
								</ul>
						";
					}
				}
				?>
			</p>
			</td>
			<td>&nbsp;&nbsp;&nbsp;</td>
		</tr>
		<?php
		$i++;}
		?>
		<?php endforeach; ?>
		<tr>
			<td width="25%">REQUEST BY : <br/><br/><br/><br/><br/><hr>--/--/-- JOC</td>
			<td width="25%">INPECTED BY : <br/><br/><br/><br/><br/><hr>--/--/-- CIE</td>
			<td width="25%">CHECKED BY : <br/><br/><br/><br/><br/><hr>--/--/-- CE</td>
			<td width="25%">APPROVED BY : <br/><br/><br/><br/><br/><hr>--/--/-- PROJECT</td>
		</tr>
	</table>
<?php endforeach; ?>
</div>
<br/>
<br/>
<br/>
<input class="btn btn-success" type="button" onclick="printDiv('printableArea')" value="Print Invoice" />